/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Bas_RouteMaterial",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using DGZImp.BasProject.DomainModels;
using DGZImp.BasProject.IServices;
using DGZImp.Core.Utilities.Response;

namespace DGZImp.BasProject.Controllers
{
    public partial class Bas_RouteMaterialController
    {
        private readonly IBas_RouteMaterialService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Bas_RouteMaterialController(
            IBas_RouteMaterialService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        [HttpPost("AddRouteMaterial")]
        public async Task<ApiResponse<object>> AddRouteMaterial([FromBody] List<Bas_RouteMaterial> list)
        {
            var res = await _service.addOrUpdateRouteMaterial(list);
            return ApiRes.SuccessMsg(res);
        }
    }
}
